﻿//Copyright © Omega Point 2008
//All rights reserved.
//This Software is Licensed under the New BSD License
//for a full copy of this license see http://www.codeplex.com/networkmessenger/license
//Redistributions of source code must retain the above copyright notice.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using OmegaPoint.Vista.Dwm;

using System.Net;

namespace NetworkMessenger
{
    /// <summary>
    /// Interaction logic for InfoWindow.xaml
    /// </summary>
    public partial class InfoWindow : Window
    {
        public InfoWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (Aero.DoesOSSupportDwm() == true)
            {
                try
                {
                    Aero.ExtendGlassFrame(this, new Thickness(-1));                   
                }
                catch (Exception)
                {
                   //Alter Background to fill area
                    backgroundRectangle.RadiusX = 0;
                    backgroundRectangle.RadiusY = 0;
                    backgroundRectangle.Opacity = 1;
                }
            }
            else
            {
                backgroundRectangle.RadiusX = 0;
                backgroundRectangle.RadiusY = 0;
                backgroundRectangle.Opacity = 1;
            }
            compNameTextBox.Text = Environment.MachineName;           
            ipTextBox.Text = Dns.GetHostEntry(Environment.MachineName).AddressList[0].ToString();
            portTextBox.Text = Tools.GetPortFromName(Environment.UserName.ToLower()).ToString();

            System.Reflection.AssemblyName name = new System.Reflection.AssemblyName(System.Reflection.Assembly.GetExecutingAssembly().FullName);
            versionTextBox.Text = name.Version.ToString();
        }
    }
}
